#pragma once
#include <game/Config.h>
#include <game/ScreenReference.h>

#include <xml/Object.h>
#include <AutoContainer.h>
#include <vector>

ARELLO_GAME_NAMESPACE_DECL_START
class ScreenReference;
namespace flow {

class EntryExitDefinition;

class EntryDefinition
	: private xml::ObjectANSI
{
public:
	EntryDefinition();
	~EntryDefinition();

	xml::ObjectANSI* GetLoader() { return this; }

	const std::string& GetName() const { return name; }
	ScreenReference* GetScreenReference();
	std::auto_ptr<ScreenReference> ReleaseScreenReference() { return this->screenReference; }

	std::vector<EntryExitDefinition*>::iterator ExitsBegin() { return this->exits.begin(); }
	std::vector<EntryExitDefinition*>::iterator ExitsEnd() { return this->exits.end(); }

	const std::string& GetSelectorClass() { return this->selectorClass; }
private:
	virtual bool on_attribute(xml::Provider * prov, const std::string & name, const std::string & value);
	virtual bool on_node(xml::Provider * prov, const std::string & name);

	std::string name;
	std::string selectorClass;
	std::auto_ptr<ScreenReference> screenReference;

	AutoContainer<std::vector<EntryExitDefinition*> > exits;

	void assertSelectorMode();
};

} // namespace flow
ARELLO_GAME_NAMESPACE_DECL_END